<?php
ob_start();
include("common/connection.php");
$group=$_POST['group'];
$batch=$_POST['batch'];
$gender=$_POST['gender'];
$full_name=$_POST['full_name'];
$nick_name=$_POST['nick_name'];
$cell_phone=$_POST['cell_phone'];
$cell_phone1=$_POST['cell_phone1'];
$email=$_POST['email'];
$address=$_POST['address'];
$amount=$_POST['amount'];
$spouse=$_POST['spouse'];
$origin=$_POST['origin'];
if($amount==1){$option="Option 1";}elseif($amount==2){$option="Option 2";}elseif($amount==3){$option="Option 3";}
if($spouse==1){$option1="Yes";}else{$option1="No";}
if($amount==1){ $fee=2000;}elseif($amount==2){$fee=4000;}elseif($amount==3){$fee=3000;}

if($spouse==1)
{
	if($amount==1||$amount==2)
	{
		$totalfee=($fee+1500);
	}
	elseif($amount==3)
	{
		$totalfee=($fee+2500);
	}
}
else
{
	$totalfee=$fee;
}
$today = date("Y-m-d");
$fackId=3585;
//echo $originId=($fackId+$origin);

/*$qryUsercheck1= "SELECT * FROM `users` WHERE `verify`='".$_POST['id_no']."'";
$resultUsercheck1=mysql_db_query($db_name,$qryUsercheck1);
$rsUsercheck1=mysql_num_rows($resultUsercheck1);*/
$qryUsercheck2= "SELECT * FROM `users` WHERE `email`='".$_POST['email']."'";
$resultUsercheck2=mysql_db_query($db_name,$qryUsercheck2);
$rsUsercheck2=mysql_num_rows($resultUsercheck2);

//$id_num=substr($_POST['id_no'], -4, 1);

if($rsUsercheck2>0)
{
	/*if($rsUsercheck1)
	{
		header("Location: index.php?group=$group&batch=$batch&gender=$gender&full_name=$full_name&nick_name=$nick_name&cell_phone=$cell_phone&cell_phone1=$cell_phone1&email=$email&address=$address&amount=$amount&spouse=$amount&mess=1");
	}*/
	if($rsUsercheck2)
	{
		header("Location: index.php?group=$group&batch=$batch&gender=$gender&full_name=$full_name&nick_name=$nick_name&cell_phone=$cell_phone&cell_phone1=$cell_phone1&email=$email&address=$address&amount=$amount&spouse=$spouse&mess=2");
	}
	/*elseif($id_num==0)
	{
		header("Location: index.php?group=$group&batch=$batch&gender=$gender&full_name=$full_name&nick_name=$nick_name&cell_phone=$cell_phone&cell_phone1=$cell_phone1&email=$email&address=$address&amount=$amount&spouse=$amount&mess=3");
	}*/
	
}
else
{
if($_POST['group']!=''&&$_POST['batch']!=''&&$_POST['gender']!=''&&$_POST['full_name']!=''&&$_POST['nick_name']!=''&&$_POST['cell_phone']!=''&&$_POST['email']!=''&&$_POST['address']!=''&&$_POST['amount']!=''&&$_POST['spouse']!='')
{
$queryUser1="SELECT max(id) as id FROM `users`";
$resultUser1=mysql_db_query($db_name,$queryUser1);
$rsUser1=mysql_fetch_array($resultUser1);

$originId=$fackId+$rsUser1[0]+1;

$addUser="INSERT INTO `users` (`group`,`batch`,`gender`,`f_name`,`n_name`,`cell_num`,`cell_num1`,`email`,`address`,`regis_option`,`spouse`,`verify`,`created_date`) VALUES ('".$_POST['group']."','".$_POST['batch']."','".$_POST['gender']."','".$_POST['full_name']."','".$_POST['nick_name']."','".$_POST['cell_phone']."','".$_POST['cell_phone1']."','".$_POST['email']."','".$_POST['address']."','".$_POST['amount']."','".$_POST['spouse']."','$originId','$today')";
$resultUsers=mysql_db_query($db_name,$addUser);
}

$queryUser="SELECT max(id) as id FROM `users`";
$resultUser=mysql_db_query($db_name,$queryUser);
$rsUser=mysql_fetch_array($resultUser);
$uid=$rsUser['id'];

$content="<table width='100%' border='0' cellpadding='0' cellspacing='0'>
  <tr>
    <td>
   
    <table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
      <tr bgcolor='#003366'>
        <td><table width='100%' border='0' cellpadding='0' cellspacing='0'>
          <tr>
            <td align='center'><h1><font style='font-family:Verdana, Arial, Helvetica, sans-serif;
color:#FFFFFF;'>IBA REUNION 2012</font></h1></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td><table width='100%' border='0' bgcolor='#000000' cellpadding='1' cellspacing='1'>
  <tr>
    <td bgcolor='#ffffff'><table width='100%' border='0' cellpadding='0' cellspacing='0'>
          <tr height='30'>
            <td width='20%' align='center' class='datetime'>Date</td>
            <td width='60%' align='center' bgcolor='#99CCCC' class='datetime'>Bangabandhu International Conference Centre</td>
            <td width='20%' align='center' class='datetime'>Time</td>
          </tr>
          <tr height='30'>
            <td align='center' bgcolor='#99CCCC' class='datetime'>27 Jan 2012</td>
            <td align='center' class='datetime'>Venue</td>
            <td align='center' bgcolor='#99CCCC' class='datetime'>3pm - 11pm</td>
          </tr>
        </table></td>
  </tr>
</table></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>      
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td><table width='100%' border='0' bgcolor='#000000' cellpadding='1' cellspacing='1'>
          <tr>
            <td bgcolor='#ffffff'><table width='100%' border='0' cellpadding='0' cellspacing='0'>
              <tr>
                <td align='center' style='font-family:Arial, Helvetica, sans-serif;
color:#3399CC;
font-size:24px;
font-weight:normal'>Thank you for registering for IBA REUNION 2012.</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td align='center' style='font-family:Arial, Helvetica, sans-serif;
color:#000000;
font-size:16px;
font-weight:normal;'>Your Full Name is: $full_name<br />Your Cell No is: $cell_phone<br /><br />Your Reunion ID is: <b>$originId</b><br />
Your total registration fee is: BDT <b>$totalfee</b><br /><br />You Have Selected: $option<br />Bringing Your Spouse:$option1<br /><br /><br>
<b>PLEASE BRING PRINT OUT OF THIS PAGE AT THE PAYMENT POINT</b>
<br />[Driver's Dinner Coupon (optional) will be sold at BDT 300 at Payment Point]<br /><br>


</td>
              </tr>
              <tr>
                <td align='left'>Payment Points:<br />
&nbsp;&nbsp;IBA (Alumni Office) - 8611819<br />
&nbsp;&nbsp;IBA (Alumni Office) - Khokon - 8801911368313<br />
&nbsp;&nbsp;IBA (BBA 14th Batch) - Joydeep - 8801720342316<br />
&nbsp;&nbsp;Dhanmondi (Beximco Pharma) - Rizvi Bhai - 8801711522059<br />
&nbsp;&nbsp;Motijheel (AB Bank) - Joy Bhai - 8801713000606<br />
&nbsp;&nbsp;Motijheel - (The City Bank) - Nadia - 8801713367578<br />
&nbsp;&nbsp;Banglamotor (Access Telecom) - Salahuddin - 8801711530790<br />
&nbsp;&nbsp;Mohammadpur (MCG) - Rafiq Bhai - 8801711567401<br />
&nbsp;&nbsp;Shamoly (Inpace Communication) - Afzal - 8801730013807<br />
&nbsp;&nbsp;Karwan Bazar (One Bank) - Johora Apa - 8801199884043<br />
&nbsp;&nbsp;Uttara (Berger Paints) - Shaher Bhai - 8801713016464<br />
&nbsp;&nbsp;Uttara (Aktel) - Barna - 8801819210925<br />
&nbsp;&nbsp;Banani (MBA Club) - 9886411<br />
&nbsp;&nbsp;Banani (MBA Club) - Songram - 8801711001001<br />
&nbsp;&nbsp;Gulshan-2 (Grameen Phone) - Tarik - 8801711080828<br />
&nbsp;&nbsp;Gulshan-2 (Grameen Phone) - Faisal - 8801711080567<br />
&nbsp;&nbsp;Gulshan-2 (Grameen Phone) - Nawed - 8801711502280<br />
&nbsp;&nbsp;Gulshan-2 (Grameen Phone) - Rajib - 8801711505940<br />
&nbsp;&nbsp;Mohakhali (BATBC) - Shabab - 8801713040303<br />
&nbsp;&nbsp;Gulshan-1 (UniLever) - Ratan - 8801911310399<br />
&nbsp;&nbsp;Gulshan-1 (UniLever) - Sami - 8801713037778<br />
&nbsp;&nbsp;Gulshan Avenue (Standard Chartered Bank) - Aziz - 8801714093267<br />
&nbsp;&nbsp;Gulshan Avenue (Standard Chartered Bank) - Rana - 8801713061948</td>
              </tr>
              <tr>
                <td align='center'>&nbsp;</td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table>
    
    </td>
  </tr>
</table>";
//echo $content;

$subject="IBA REUNION 2012 REGISTRATION CONFIRMATION.";
$headers ="MIME-Version: 1.0\n";
$headers .= "From: reg-confirm@iba-reunion.net\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$email=$_POST['email'];
	if($email!='')
	{
		mail("$email","$subject","$content",$headers);
		header("Location: reg_success.php?id=$uid");
	}
	}
?>
